<?xml version="1.0"?>

<!-- gjdoc-classdoc.rng
     Copyright (C) 2003 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
 
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. -->

<grammar 
      xmlns="http://relaxng.org/ns/structure/1.0" 
      xmlns:a="http://relaxng.org/ns/annotation/1.0" 
      xmlns:gjdoc="http://www.gnu.org/software/cp-tools/gjdocxml">

   <include href="gjdoc-common.rng"/>
   
   <a:documentation>
      The Relax NG grammar for an classdoc XML document generated by
      GNU Gjdoc.
   </a:documentation>

   <start>
      <a:documentation>
	 The root element for a Gjdoc classdoc XML document.
      </a:documentation>

      <element name="gjdoc:classdoc">
	 <a:documentation>
	    Corresponds to a Javadoc API com.sun.javadoc.ClassDoc
	    object, the subtree of the full generated documentation
	    corresponding to a particular Java class.
	 </a:documentation>

	 <ref name="name-attribute"/>
	 <ref name="qualifiedtypename-attribute"/>

	 <optional>
	    <ref name="superclass-element"/>
	 </optional>

	 <zeroOrMore>
	    <ref name="implements-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="superimplements-element"/>
	 </zeroOrMore>

	 <ref name="ProgramElementDocBody"/>

	 <optional>
	    <ref name="isAbstract-element"/>
	 </optional>

	 <optional>
	    <ref name="isSerializable-element"/>
	 </optional>

	 <optional>
	    <ref name="isExternalizable-element"/>
	 </optional>

	 <optional>
	    <ref name="definesSerializableFields-element"/>
	 </optional>

	 <zeroOrMore>
	    <ref name="constructordoc-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="methoddoc-element"/>
	 </zeroOrMore>

	 <zeroOrMore>
	    <ref name="fielddoc-element"/>
	 </zeroOrMore>

      </element>      

   </start>

   <!-- The following patterns are "body" patterns for the element
   patterns below. Their content corresponds to the abstract
   superclasses of the classes which are represented by the "element"
   patterns below.  -->

   <define name="DocBody">
      <a:documentation>
	 Corresponds to the abstract class
	 <code>com.sun.javadoc.Doc</code>, the common base class for
	 all documentation classes.
      </a:documentation>

      <optional>
	 <ref name="isClass-element"/>
      </optional>

      <optional>
	 <ref name="isConstructor-element"/>
      </optional>

      <optional>
	 <ref name="isError-element"/>
      </optional>

      <optional>
	 <ref name="isException-element"/>
      </optional>

      <optional>
	 <ref name="isField-element"/>
      </optional>

      <optional>
	 <ref name="isIncluded-element"/>
      </optional>

      <optional>
	 <ref name="isInterface-element"/>
      </optional>

      <optional>
	 <ref name="isMethod-element"/>
      </optional>

      <optional>
	 <ref name="isOrdinaryClass-element"/>
      </optional>

      <optional>
	 <ref name="inlineTags-element"/>
      </optional>

      <optional>
	 <ref name="firstSentenceTags-element"/>
      </optional>

      <optional>
	 <ref name="tags-element"/>
      </optional>

      <optional>
	 <ref name="seeTags-element"/>
      </optional>

   </define>

   <define name="ProgramElementDocBody">
      <a:documentation>
	 Corresponds to the abstract class
	 <code>com.sun.javadoc.ProgramElementDoc</code>.
      </a:documentation>

      <!-- ... which is derived from class com.sun.javadoc.Doc -->
      <ref name="DocBody"/>

      <ref name="containingPackage-element"/>

      <optional>
	 <ref name="containingClass-element"/>
      </optional>
      
      <ref name="access-element"/>
      
      <optional>
	 <ref name="isFinal-element"/>
      </optional>

      <optional>
	 <ref name="isStatic-element"/>
      </optional>

   </define>

   <define name="MemberDocBody">
      <a:documentation>
	 Corresponds to the abstract class
	 <code>com.sun.javadoc.MemberDoc</code>.
      </a:documentation>

      <!-- ... which is derived from class
      com.sun.javadoc.ProgramElementDoc -->
      <ref name="ProgramElementDocBody"/>

   </define>

   <define name="ExecutableMemberDocBody">
      <a:documentation>
	 Corresponds to the abstract class
	 <code>com.sun.javadoc.ExecutableMemberDoc</code>.
      </a:documentation>

      <!-- ... which is derived from class 
      com.sun.javadoc.MemberDoc -->
      <ref name="MemberDocBody"/>

      <zeroOrMore>
	 <ref name="parameter-element"/>
      </zeroOrMore>

      <zeroOrMore>
	 <ref name="thrownException-element"/>
      </zeroOrMore>

      <ref name="signature-element"/>

      <optional>
	 <ref name="isNative-element"/>
      </optional>

      <optional>
	 <ref name="isSynchronized-element"/>
      </optional>

   </define>

   <define name="ConstructorDocBody">
      <a:documentation>
	 Corresponds to an object of class
	 <code>com.sun.javadoc.ConstructorDoc</code>.
      </a:documentation>

      <!-- ... which is derived from class
      com.sun.javadoc.ExecutableMemberDoc -->
      <ref name="ExecutableMemberDocBody"/>

   </define>

   <define name="MethodDocBody">
      <a:documentation>
	 Corresponds to an object of class
	 <code>com.sun.javadoc.MethodDoc</code>.
      </a:documentation>

      <!-- ... which is derived from class
      com.sun.javadoc.ExecutableMemberDoc -->
      <ref name="ExecutableMemberDocBody"/>

      <ref name="returns-element"/>
   </define>

   <define name="FieldDocBody">
      <a:documentation>
	 Corresponds to an object of class
	 <code>com.sun.javadoc.FieldDoc</code>.
      </a:documentation>

      <!-- ... which is derived from class
      com.sun.javadoc.ProgramElementDoc -->
      <ref name="ProgramElementDocBody"/>

      <optional>
	 <ref name="isTransient-element"/>
      </optional>

      <optional>
	 <ref name="isVolatile-element"/>
      </optional>

      <element name="gjdoc:type">
	 <ref name="typedef-attributes"/>
      </element>

   </define>


   <!-- The following patterns define the elements representing
   concrete classes in the Javadoc API. -->

   <define name="constructordoc-element">
      <a:documentation>
	 Specifies a constructor of the class.
      </a:documentation>

      <element name="gjdoc:constructordoc">
	 <ref name="name-attribute"/>
	 <ref name="ConstructorDocBody"/>
      </element>
   </define>

   <define name="methoddoc-element">
      <a:documentation>
	 Specifies a method of the class.
      </a:documentation>

      <element name="gjdoc:methoddoc">
	 <ref name="name-attribute"/>
	 <ref name="MethodDocBody"/>
      </element>
   </define>

   <define name="fielddoc-element">
      <a:documentation>
	 Specifies a field of the class.
      </a:documentation>

      <element name="gjdoc:fielddoc">
	 <ref name="name-attribute"/>
	 <ref name="FieldDocBody"/>
      </element>
   </define>

   <!-- The following patterns represent the return value of the
   corresponding boolean getters of various classes in
   <code>com.sun.javadoc</code>. The presence of each tag denotes a
   return value of <code>true</code>, absence denotes a return value
   of <code>false</code>. -->

   <define name="isAbstract-element">
      <a:documentation>
	 Presence means <code>ClassDoc.isAbstract()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isAbstract">
	 <empty/>
      </element>
   </define>

   <define name="isClass-element">
      <a:documentation>
	 Presence means <code>Doc.isClass()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isClass">
	 <empty/>
      </element>
   </define>

   <define name="isConstructor-element">
      <a:documentation>
	 Presence means <code>Doc.isConstructor()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isConstructor">
	 <empty/>
      </element>
   </define>

   <define name="isError-element">
      <a:documentation>
	 Presence means <code>Doc.isError()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isError">
	 <empty/>
      </element>
   </define>

   <define name="isException-element">
      <a:documentation>
	 Presence means <code>Doc.isException()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isException">
	 <empty/>
      </element>
   </define>

   <define name="isSerializable-element">
      <a:documentation>
	 Presence means <code>ClassDoc.isSerializable()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isSerializable">
	 <empty/>
      </element>
   </define>

   <define name="isExternalizable-element">
      <a:documentation>
	 Presence means <code>ClassDoc.isExternalizable()</code>
	 returns <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isExternalizable">
	 <empty/>
      </element>
   </define>

   <define name="isField-element">
      <a:documentation>
	 Presence means <code>Doc.isField()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isField">
	 <empty/>
      </element>
   </define>

   <define name="isIncluded-element">
      <a:documentation>
	 Presence means <code>Doc.isIncluded()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isIncluded">
	 <empty/>
      </element>
   </define>

   <define name="isInterface-element">
      <a:documentation>
	 Presence means <code>Doc.isInterface()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isInterface">
	 <empty/>
      </element>
   </define>

   <define name="isMethod-element">
      <a:documentation>
	 Presence means <code>Doc.isMethod()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isMethod">
	 <empty/>
      </element>
   </define>

   <define name="isOrdinaryClass-element">
      <a:documentation>
	 Presence means <code>Doc.isOrdinaryClass()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isOrdinaryClass">
	 <empty/>
      </element>
   </define>

   <define name="isFinal-element">
      <a:documentation>
	 Presence means <code>ProgramElementDoc.isFinal()</code>
	 returns <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isFinal">
	 <empty/>
      </element>
   </define>

   <define name="isStatic-element">
      <a:documentation>
	 Presence means <code>ProgramElementDoc.isStatic()</code>
	 returns <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isStatic">
	 <empty/>
      </element>
   </define>

   <define name="isTransient-element">
      <a:documentation>
	 Presence means <code>FieldDoc.isTransient()</code>
	 returns <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isTransient">
	 <empty/>
      </element>
   </define>

   <define name="isVolatile-element">
      <a:documentation>
	 Presence means <code>FieldDoc.isVolatile()</code>
	 returns <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isVolatile">
	 <empty/>
      </element>
   </define>

   <define name="isNative-element">
      <a:documentation>
	 Presence means <code>ExecutableMemberDoc.isNative()</code>
	 returns <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isNative">
	 <empty/>
      </element>
   </define>

   <define name="isSynchronized-element">
      <a:documentation>
	 Presence means
	 <code>ExecutableMemberDoc.isSynchronized()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:isSynchronized">
	 <empty/>
      </element>
   </define>

   <define name="definesSerializableFields-element">
      <a:documentation>
	 Presence means
	 <code>ClassDoc.definesSerializableFields()</code> returns
	 <code>true</code>.
      </a:documentation>

      <element name="gjdoc:definesSerializableFields">
	 <empty/>
      </element>
   </define>

   <define name="access-element">
      <a:documentation>
	 Corresponds to the access modifier (public, protected,
	 private) specified by a ProgramElementDoc.
      </a:documentation>

      <element name="gjdoc:access">
	 <attribute name="scope">
	    <a:documentation>
	       This value is determined by calling
	       <code>ProgramElementDoc.isPublic()</code>,
	       <code>ProgramElementDoc.isProtected()</code>,
	       <code>ProgramElementDoc.isPrivate()</code> and
	       <code>ProgramElementDoc.isPackagePrivate()</code>.
	    </a:documentation>
	    <choice>
	       <value>public</value>
	       <value>protected</value>
	       <value>private</value>
	       <value>package</value>
	    </choice>
	 </attribute>
      </element>
   </define>

   <define name="containingClass-element">
      <a:documentation>
	 Corresponds to the type returned by a call to
	 <code>com.sun.javadoc.Classdoc.containingClass()</code>.
      </a:documentation>

      <element name="gjdoc:containingClass">
	 <a:documentation>
	    The full name of the outer class containing the class, if
	    this class is an inner class.
	 </a:documentation>
	 <ref name="typedef-attributes"/>
      </element>
   </define>

   <define name="parameter-element">
      <a:documentation>
	 Corresponds to an entry in the array returned by a
	 <code>com.sun.javadoc.ExecutableMemberDoc.parameters()</code>.
      </a:documentation>

      <element name="gjdoc:parameter">
	 <a:documentation>
	    A parameter for a method or constructor call.
	 </a:documentation>
	 <ref name="name-attribute"/>	 
	 <optional>
	    <ref name="typedef-attributes"/>
	 </optional>
      </element>
   </define>

   <define name="thrownException-element">
      <a:documentation>
	 Corresponds to an entry in the array returned by a
	 <code>com.sun.javadoc.ExecutableMemberDoc.thrownExceptions()</code>.
      </a:documentation>

      <element name="gjdoc:thrownException">
	 <a:documentation>
	    An exception thrown by a method or constructor.
	 </a:documentation>
	 <ref name="typedef-attributes"/>
      </element>
   </define>


   <define name="signature-element">
      <a:documentation>
	 Corresponds to the signature specified by a
	 <code>com.sun.javadoc.MethodDoc</code>.
      </a:documentation>

      <element name="gjdoc:signature">
	 <a:documentation>
	    The signature of a method or constructor.
	 </a:documentation>
	 <attribute name="full">
	    <a:documentation>
	       The full signature of a method or constructor, as
	       returned by
	       <code>com.sun.javadoc.ExecutableMemberDoc.signature()</code>.
	    </a:documentation>
	    <text/>
	 </attribute>
	 <attribute name="flat">
	    <a:documentation>
	       The "flat" signature of a method or constructor, as
	       returned by
	       <code>com.sun.javadoc.ExecutableMemberDoc.flatSignature()</code>.
	    </a:documentation>
	    <text/>
	 </attribute>
      </element>
   </define>

   <define name="returns-element">
      <a:documentation>
	 Corresponds to the type returned by
	 <code>com.sun.javadoc.MethodDoc.returnType()</code>.
      </a:documentation>

      <element name="gjdoc:returns">
	 <a:documentation>
	    The type returned by a method.
	 </a:documentation>

	 <ref name="typedef-attributes"/>
      </element>
   </define>
</grammar>
